<!DOCTYPE HTML>
<html>
<head>
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>Test#add_cleanup: multiple functions with one in error</title>
<script src="../../variants.js"></script>
<script src="../../../testharness.js"></script>
<script src="../../../testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>

<script>
"use strict";

test(function(t) {
    t.add_cleanup(function() {
      throw new Error("exception in cleanup function");
    });

    // The following cleanup function defines a test so that the reported
    // data demonstrates the intended run-time behavior, i.e. that
    // `testharness.js` invokes all cleanup functions even when one or more
    // throw errors.
    t.add_cleanup(function() {
      test(function() {}, "Verification test");
    });
  }, "Test with multiple cleanup functions");
</script>
<script type="text/json" id="expected">
{
  "summarized_status": {
    "status_string": "ERROR",
    "message": "Test named 'Test with multiple cleanup functions' specified 2 'cleanup' functions, and 1 failed."
  },
  "summarized_tests": [
    {
      "status_string": "PASS",
      "name": "Test with multiple cleanup functions",
      "properties": {},
      "message": null
    },
    {
      "status_string": "NOTRUN",
      "name": "Verification test",
      "properties": {},
      "message": null
    }
  ],
  "type": "complete"
}
</script>
</body>
</html>
